#include <cstdio>

void init( int use[ ] )
{
    int i;
    for ( i = 1; i <= 100; i++ )
        use[ i ] = -1;
}

int main( )
{
    int p, use[ 101 ], t1, t2, count = 0;
    char s[ 5 ], tmp;
    double time;
    while ( scanf("%d", &p) != EOF )
    {
        if ( p == -1 )
            break;
        scanf("%s", s);
        scanf("%d%c%d", &t1, &tmp, &t2);
        if ( p == 0 )
        {
            if ( count == 0 )
                printf("0 0\n");
            else
                printf("%d %.0lf\n", count, time / count);
            count = 0;
            time = 0;
            init( use );
        }
        else
        {
            if ( s[ 0 ] == 'S' )
                use[ p ] = t1 * 60 + t2;
            if ( s[ 0 ] == 'E' )
            {
                if ( use[ p ] != -1 )
                {
                    time += t1 * 60 + t2 - use[ p ];
                    use[ p ] = -1;
                    count++;
                }
            }
        }
    }
    return 0;
}
